home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 9001 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.2 KB

  1. Path: news.ov.com!news
  2. From: glenn@ov.com (Fletcher.Glenn@ov.com)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: f;oating point precision
  5. Date: 7 Mar 1996 16:32:21 GMT
  6. Organization: OpenVision
  7. Message-ID: <4hn32l$rvt@spanky.pls.ov.com>
  8. References: <c0d_9603050128@csource.blaze.net.au>
  9. Reply-To: glenn@ov.com
  10. NNTP-Posting-Host: foghorn.pls.ov.com
  11.  
  12. In article 9603050128@csource.blaze.net.au, David.Burrows@f158.n633.z3.fidonet.org (David Burrows) writes:
  13. >Help.... I am getting floating point innaccuracies at about the 4th decimal
  14. >
  15. >place. eg i enter 510.0250 and it comes out as 510.0249.
  16. >I am just starting to learn c so please excuse my ignorance.
  17. >                                                             dave
  18. >
  19. >--
  20. >David.Burrows@f158.n633.z3.fidonet.org, David Burrows 3:633/158 (FidoNet)
  21. >
  22.  
  23. Your machine uses binary to represent numbers and to perform calculations.
  24. There are many decimal fractions that cannot be represented exactly in 
  25. binary because they require non-terminating binary fractions.  The machine
  26. will use the nearest possible binary approximation for your floating
  27. point calculations.  The limit of the approximation is determined by the
  28. word size of the mantissa.  You can increase accuracy using a double instead
  29. of a float.
  30.  
  31.             Fletcher.Glenn@ov.com
  32.  
  33.  
  34.